package com.xdu.yunwufog.common;

public class Result {
    // 前端成功是20000，这里先做一点更改
    /**
     * code:200-请求成功处理；5000-出错
     */
    private int code;
    private String message;
    private Object data;

    public Result(int code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }
//    public Result(int code, String message,Object data){}
    public Result(){};

    public static Result OK(){
        return OK(null);
    }
    public static Result OK(Object data){
        return new Result(200,"操作成功",data);
    }
    public static Result ERROR(){
        return ERROR("操作失败");
    }
    public static Result ERROR(Object message){
        return new Result(5000,"操作失败",message);
    }
    public static Result ERROR500(){
        return new Result(500,"操作失败","认证服务未开启");
    }
    public static Result ERROR500(Object message){
        return new Result(500,"操作失败",message);
    }



    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
